package com.hu.service.Impl;

import com.hu.mapper.UserMapper;
import com.hu.pojo.User;
import com.hu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ZhouKai
 * 2022/5/2 20:53
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    /**
     * 登录检查
     *
     * @param username 账号
     * @param pwd      密码
     * @return 检查结果
     */
    @Override
    public String loginCheck(String username, String pwd) {
        User user = userMapper.getUser(username);
        if(user==null) {
            return "用户不存在";
        } else if(!user.getPwd().equals(pwd)) {
            return "密码错误";
        } else {
            return "成功";
        }
    }
}
